import { createRouter, createWebHistory } from 'vue-router'
import Home from "./views/Home/Home.vue"
//2. 创建路由实例
const router = createRouter({
    //2.1 路由模式
    history: createWebHistory(import.meta.env.BASE_URL),
    //2.2 路由配置规则
    routes: [
        {
            path: '/user',
            name: 'User',
            component: () => import('./views/User/User.vue'),
            //使用children属性来 匹配嵌套路由规则
            children: [
                {
                    path: 'user1',
                    name: 'User1',
                    component: () => import('./views/User/User1.vue')
                },
                {
                    path: 'user2',
                    name: 'User2',
                    component: () => import('./views/User/User2.vue')
                }
            ]
        }
    ]
})
//3.将路由对象导出
export default router
